<template>
    <view>
        <custom><template #backText>发货渠道</template></custom>
        <crud ref="crud" :title="crud.title" :url_list="crud.url_list" :url_update="crud.url_update" :form="crud.form">
            <template #list="data">
                <nMenuItemContentAction v-for="(info, key) in data.list" :key="key" class="bg-white">
                    <template #content>
                        {{info.name}}
                    </template>
                    <template #action>
                        <nButton title="删除" bg="bg-red" class="sm" :tap="()=>{$refs.crud.delete(info)}"></nButton>
                        <nButton title="编辑" class="margin-left-20 sm" :tap="()=>{$refs.crud.update(info)}"></nButton>
                    </template>
                </nMenuItemContentAction>
            </template>
            <template #form="data">
                <template v-if="data.data.form.is_delete==1">
                    <view class="text-center">确定要删除发货渠道“{{data.data.form.name}}”吗？</view>
                </template>
                <nFormItem v-else title="发货渠道" :data.sync="data.data" field="name"></nFormItem>
            </template>
        </crud>
    </view>
</template>

<script>
    import crud from '@/components/nddyny/crud.vue';
    export default {
        components: {
            crud,
        },
        data() {
            return {
                crud: {
                    title: '发货渠道',
                    url_list: '/seller/item/sendChannelList',
                    url_update: '/seller/item/updateSendChannel',
                    form: {
                        send_channel_id: '',
                        name: '',
                        is_delete: '',
                    }
                }
            };
        },
        onLoad() {},
        methods: {},
    }
</script>
